#include	<iostream>
#include	<cfloat>
#include	<cmath>
using	namespace	std;

double	transform(uint64_t	x,	uint32_t	type){
	double	s=0;
	for(size_t	i=1;	i<=x;	i++)	s+=1.0/i;
	if(type==0)	return	1;	//	1
	else	if(type==1)	return	log(x);		//	ln(x)
	else	if(type==2)	return	s;	//	Basel(x)
	else	if(type==3)	return	sqrt(x);	//	sqrt(x)
	else	if(type==4)	return	x;	//	x
	else	if(type==5)	return	x*log(x);	//	x*ln(x)
	else	if(type==6)	return	x*x;	//	x^2
	else	if(type==7)	return	cbrt(x);	//	cbrt(x)
	else	return	0;
}

int	main(int	ac,	char	**av){
	if(ac!=3){	cerr<<"optimus_prime nonembedding_parameters layer_parameter_factor(12 for GPT2)\n";	return	0;	}
	uint64_t	budget=atoll(av[1]);	double	alpha=atof(av[2]);
	string	fname[8]={"1","ln(x)","Basel(x)","sqrt(x)","x","x*ln(x)","x*x","cbrt(x)"};	
	for(size_t	tw=0;	tw<sizeof(fname)/sizeof(string);	tw++)	for(size_t	tl=0;	tl<sizeof(fname)/sizeof(string);	tl++){
	double	best=-FLT_MAX;	uint64_t	bw=0,bl=0;
	for(uint64_t	w=1;	w<65536;	w++){
		for(uint64_t	l=1;	l<=1024;	l++){
			if(alpha*w*w*l>budget)	continue;
			double	x=transform(w,tw)*transform(l,tl);
			if(x>best){	best=x;	bw=w;	bl=l;	}
		}
	}
	if(bl>=10&&bl<=100)	cout<<"Transform(W)="<<fname[tw]<<"\tTransform(L)="<<fname[tl]<<"\tW="<<bw<<"\tL="<<bl<<'\n';
	}
	return	0;
}
